package rickyGame.ui.pack
{
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import rickyGame.controller.Controller;
	

	/**
	 * 格子物品</br>
	 * 只是显示用
	 */
	public class Grid extends Sprite
	{
		public function Grid()
		{
			super();
			this.mouseEnabled=false; 
		}
		
		/**
		 * 上一个父对像
		 */
		public function get oldParent():DisplayObjectContainer
		{
			return _oldParent;
		}
		
		public function set oldParent(value:DisplayObjectContainer):void
		{
			_oldParent = value;
		}
		
		/**
		 * 操作
		 * @param par:* 参数
		 */
		public function operate(par:*):Boolean
		{
			return true;
		}
		
		/**
		 * 设置图标
		 */
		public function set setIcon(bitdata:BitmapData):void
		{
			this.graphics.clear();
			this.graphics.beginBitmapFill(bitdata,null,false);
			this.graphics.drawRect(0,0,bitdata.width,bitdata.height);
			this.graphics.endFill();

		}

		//protected
		protected function onAddedToStage(e:Event):void
		{
			this._oldParent=this.parent;
		}

		/**
		 * 鼠标移动到上面的提示
		 */
		public function get tips():String
		{
			return _tips;
		}

		public function set tips(value:String):void
		{
			_tips = value;
		}

		/**
		 * 是否锁定
		 * 锁定了不能拖动
		 */
		public function get islock():Boolean
		{
			return _islock;
		}

		public function set islock(value:Boolean):void
		{
			_islock = value;
		}

		/**
		 * 快捷操作键
		 */
		public function get keyCode():int
		{
			return _keyCode;
		}
		
		public function set keyCode(value:int):void
		{
			_keyCode = value;
		}
		//private 
		private var _isdragging:Boolean=false;
		private var _islock:Boolean=false;
		private var _oldParent:DisplayObjectContainer;//原来位置
		private var _tips:String;
		private var _keyCode:int;

	}
}